<?php $this->pageTitle=Yii::app()->name . ' - '.Yii::t("user", "注册");
$this->breadcrumbs=array(
	Yii::t("UserModule.user", "Registration"),
);
?>

<b> <?php echo Yii::t("UserModule.user", "当前操作: 注册"); ?> </b>
<span class="note"> <?php	echo Yii::t("UserModule.user", 'Whole Required'); ?></span>

<div class="form form-left">
  <?php if(Yii::app()->user->hasFlash('registration')): ?>
    <div class="success">
    <?php echo Yii::app()->user->getFlash('registration'); ?>
    </div>
  <?php else: ?>

    <?php echo CHtml::beginForm(); ?>
      <?php echo CHtml::errorSummary($form); ?>
      <div class="row">
        <?php echo CHtml::activeLabelEx($form,'username'); ?>
        <?php echo CHtml::activeTextField($form,'username'); ?>
      </div>
      
      <div class="row">
        <?php echo CHtml::activeLabelEx($form,'password'); ?>
        <?php echo CHtml::activePasswordField($form,'password'); ?>
        <span class="hint">
          <?php echo Yii::t("UserModule.user", "Minimal password length 4 symbols."); ?>
        </span>
      </div>
      
      <div class="row">
        <?php echo CHtml::activeLabelEx($form,'verifyPassword'); ?>
        <?php echo CHtml::activePasswordField($form,'verifyPassword'); ?>
      </div>
      <div class="option-advance" style="margin-bottom:6px;">
        <a href="#" onClick="show_or_hidden('hidden-field');return false;" class="reg-url-context">详细信息&nu;</a>
        <div id="hidden-field" style="display:none;">
          <div class="row">
            <?php echo CHtml::activeDropDownList($form,'gender', array(0=>'女', 1=>'男'), array('empty' => '选择性别')); ?>
          </div>
          <?php 
            $profileFields=ProfileField::model()->forRegistration()->sort()->findAll();

            if ($profileFields) {
              $profile = new Profile();

              foreach($profileFields as $field) {
          ?>
            <div class="row">
              <?php echo CHtml::activeLabelEx($profile, $field->varname); ?>
              <?php 
              if ($field->range) {
                echo CHtml::activeDropDownList($profile,
                    $field->varname,
                    Profile::range($field->range));
              }
              elseif ($field->field_type == "TEXT") {
                echo CHtml::activeTextArea($profile,
                    $field->varname, 
                    array('rows'=>6, 'cols'=>50));
              }
              else {
                echo CHtml::activeTextField($profile,
                    $field->varname,
                    array(
                      'size'=>20,
                      'maxlength'=>(($field->field_size)?$field->field_size:255)));
              }
            ?>
            <?php echo CHtml::error($profile,$field->varname); ?>
          </div>  
          <?php
              }
            }
          ?>
        </div>
      </div>

    <?php if(extension_loaded('gd')): ?>
      <div class="row">
        <?php echo CHtml::activeLabelEx($form,'verifyCode'); ?>
        <div>
          <?php $this->widget('CCaptcha'); ?>
          <?php echo CHtml::activeTextField($form,'verifyCode'); ?>
          <span class="hint"><?php echo Yii::t("UserModule.user","Letters are not case-sensitive."); ?></span>
        </div>
      </div>
    <?php endif; ?>

    <div class="row submit">
      <?php echo CHtml::submitButton(Yii::t("UserModule.user", "Registration")); ?>
    </div>

    <?php echo CHtml::endForm(); ?>
  <?php endif; ?>
</div><!-- form -->

<!--Right-->
<div class="form-right">
  <p>
    <b>如果您已经是会员?</b>
    <br/>
    <span style="line-height:26px;">
      &crarr; <?php echo CHtml::link(Yii::t("UserModule.user", "点此登录"), $this->module->loginUrl)?>
    </span>
  </p>
  <p>
    <b>如果您忘记密码?</b>
    <br/>
    <span style="line-height:26px;">
      &crarr; <?php echo CHtml::link(Yii::t("UserModule.user", "找回密码"), $this->module->recoveryUrl)?>
    </span>
  </p>
</div>
<!--End Right-->
